app.factory('$mydialog', function(
    $rootScope,
    $interval,
    $state,
    $timeout,
    $ionicModal,
    $ionicLoading,
    $ionicPopup) {
    function MyDialog() {}
    MyDialog.prototype.success = function(scope) { //成功提示
        var myPopup = $ionicPopup.show({
            templateUrl: 'templates/module/success.html',
            scope: scope
        });
        setTimeout(function() {
            myPopup.close();
        }, 2500);
        return myPopup;
    };

    MyDialog.prototype.fail = function(scope) { //失败提示
        var myPopup = $ionicPopup.show({
            templateUrl: 'templates/module/fail.html',
            scope: scope
        });
        setTimeout(function() {
            myPopup.close();
        }, 2500);
        return myPopup;
    };


    return new MyDialog();

});
